home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / Graphics / include / bspnode_3d.h < prev    next >
Encoding:
Text File  |  1995-03-26  |  2.3 KB  |  39 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    bspnode.h
  3. //    Date:                    9/26/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the class definition for a bsp tree node
  7. //
  8. //------------------------------------------------------------------------------
  9.  
  10. #include "bsptree_3d.h"
  11.  
  12. #ifndef BSPNODE
  13. #define BSPNODE
  14.  
  15. //------------------------------------------------------------------------------
  16. class    bspnode                                                                                                                                        //    binary space partition tree node class
  17. {                                                                                                                                                                //    begin class definition
  18.     friend    class    bsptree;                                                                                                                //    bsptree can play with my private parts
  19.     private:                                                                                                                                            //    members internal to this class only
  20.     protected:                                                                                                                                        //    members internal to this class hierarchy
  21.                 plane_3d        plane;                                                                                                                //    the plane_3d equation of this node
  22.                 listptr    on;                                                                                                                            //    list of faces on the plane_3d
  23.                 bsptree    in;                                                                                                                            //    subtree of the "in" space relative to the plane_3d
  24.                 bsptree    out;                                                                                                                        //    subtree of the "out" space relative to the plane_3d
  25.                 bspnode (polyptr &poly);                                                                                                //    normal constructor
  26.                 ~bspnode (void);                                                                                                                //    destructor
  27.     public:                                                                                                                                                //    members available externally
  28.                 void        Insert (listptr list, hclass keep);                                                            //    selectively insert a polygon list into the tree
  29.                 void        Push (polyptr poly, listptr result, hclass keep);                                //    push a polygon through the tree
  30.                 void        Push (listptr list, listptr result, hclass keep);                                //    push a list through the tree
  31.                 void        Reduce (void);                                                                                                    //    reduce the tree to only boundary polygons
  32.                 void        Draw (const point_3d    &eye) const;                                                            //    draw the tree
  33.                 bool        RayIntersection (const ray &r, polyptr &poly_hit, point_3d &ipt) const;    //    compute the polygon intersected by a ray
  34.                 bool        PlaneSearch (const ray &r, polyptr &poly_hit, point_3d &ipt) const;//    find the intersection of a ray and the plane_3d list
  35. };                                                                                                                                                            //    end class definition
  36.  
  37. //------------------------------------------------------------------------------
  38.  
  39. #endif //BSPNODE